home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000172_icon-group-sender _Mon Aug 31 09:30:28 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) with SMTP id JAA01114
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 31 Aug 1998 09:30:28 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA21473; Mon, 31 Aug 1998 09:30:03 -0700
Date: Mon, 31 Aug 1998 09:05:25 -0700
From: kwalker@sfo.harbinger.com (Ken Walker)
Message-Id: <199808311605.JAA20565@varda.premenos.com>
To: icon-group@optima.CS.Arizona.EDU
Subject: Re: A hood fan is guard to mind.
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Md5: +9a2kKmLIC6wRuNurqTDbA==
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Content-Transfer-Encoding: 7bit
Status: RO
Content-Length: 1542
How about a version of polyspoonerisms that uses recursive generators.
It allows the sentence to be arbitrarily long by changing only data
and not the number of nested "every" expressions.
procedure main()
local fillers, firstChar, remainingChars
#
# The sentence is broken into three categories:
# parts not participating in the substitution
# the initial characters of the words involved in substitution
# the tail of the words involved in substitution
#
fillers := ["A ", " ", " is ", " to ", "."]
firstChar := ["g", "m", "h", "f"]
remainingChars := ["ood", "an", "ard", "ind"]
polyspoonerism(fillers, firstChar, remainingChars, "")
end
procedure polyspoonerism(
fillers, # words before each participating word
firstChar, # first characters to use in substitutions
remainingChars, # words (w/out 1st char) that are participating
sentence) # sentence so far
local indx
if *remainingChars = 0 then {
write(sentence, fillers[1] | "")
return
}
#
# Use each of the remaining first characters
#
every indx := 1 to *firstChar do {
#
# Add the next set of parts to the sentence then call
# the function recursively.
#
polyspoonerism(fillers[2:0],
firstChar[1:indx] ||| firstChar[indx+1:0],
remainingChars[2:0],
sentence || fillers[1] || firstChar[indx] || remainingChars[1])
}
end
Ken Walker, kenneth.walker@sfo.harbinger.com
Harbinger Coporation, Concord, Ca. 94520